home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / performSine.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  20.5 KB  |  764 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  18 April 1997
  22. //
  23. //  Description:
  24. //      sine default options box.  The content for each tab 
  25. //        is not created until it is accessed for the first time.
  26. //
  27. //////////////////////////////////////////////////////////////////////
  28. //
  29. //  Procedure Name:
  30. //      setOptionVars
  31. //
  32. //  Description:
  33. //        Initialize the option values.
  34. //
  35. //  Input Arguments:
  36. //        Whether to set the options to default values.
  37. //
  38. //  Return Value:
  39. //      None.
  40. //
  41. proc setOptionVars(int $forceFactorySettings)
  42. {
  43.     //    min.
  44.     //
  45.     if ($forceFactorySettings || !`optionVar -exists sineMin`) {
  46.         optionVar -floatValue  sineMin -1.0;
  47.     }
  48.  
  49.     //    max.
  50.     //
  51.     if ($forceFactorySettings || !`optionVar -exists sineMax`) {
  52.         optionVar -floatValue  sineMax 1.0;
  53.     }
  54.  
  55.     //    amplitude.
  56.     //
  57.     if ($forceFactorySettings || !`optionVar -exists sineAmplitude`) {
  58.         optionVar -floatValue  sineAmplitude 0.0;
  59.     }
  60.  
  61.     //    wavelength.
  62.     //
  63.     if ($forceFactorySettings || !`optionVar -exists sineWavelength`) {
  64.         optionVar -floatValue  sineWavelength 2.0;
  65.     }
  66.  
  67.     //    dropoff.
  68.     //
  69.     if ($forceFactorySettings || !`optionVar -exists sineDropoff`) {
  70.         optionVar -floatValue  sineDropoff 0.0;
  71.     }
  72.  
  73.     //    offset.
  74.     //
  75.     if ($forceFactorySettings || !`optionVar -exists sineOffset`) {
  76.         optionVar -floatValue sineOffset 0.0;
  77.     }
  78.     // default options common to all deformers
  79.     //
  80.     if ($forceFactorySettings || !`optionVar -exists sinePositioning`) {
  81.         optionVar -stringValue sinePositioning "default";
  82.     }
  83.     if ($forceFactorySettings || !`optionVar -exists sineExclusive`) {
  84.         optionVar -intValue sineExclusive 0;
  85.     }
  86.     if ($forceFactorySettings || !`optionVar -exists sineExclName`) {
  87.         // 0 == no exclusive
  88.         // 1 == exclusive with new name
  89.         // 2 == exclusive using an existing partition
  90.         //
  91.         optionVar -stringValue sineExclName "deformPartition";
  92.     }
  93. }
  94.  
  95. //
  96. //  Procedure Name:
  97. //      sineSetup
  98. //
  99. //  Description:
  100. //        Update the state of the option box UI to reflect the option values.
  101. //
  102. //  Input Arguments:
  103. //      parent               - Top level parent layout of the option box UI.
  104. //                             Required so that UI object names can be 
  105. //                             successfully resolved.
  106. //
  107. //        forceFactorySettings - Whether the option values should be set to
  108. //                             default values.
  109. //
  110. //      tabIndex             - 0 = both tabs, 1 = basic, 2 = advanced
  111. //
  112. //  Return Value:
  113. //      None.
  114. //
  115. global proc sineSetup(string $parent,
  116.                       int $forceFactorySettings,
  117.                       int $tabIndex)
  118. {
  119.     //    Retrieve the option settings
  120.     //
  121.     setOptionVars($forceFactorySettings);
  122.     setParent $parent;
  123.  
  124.     //    Query the optionVar's and set the values into the controls.
  125.     //
  126.     if ($tabIndex != 2) {        
  127.         //    min.
  128.         //
  129.         if (`floatSliderGrp -exists sineMin`) {
  130.             floatSliderGrp -edit 
  131.                 -value `optionVar -query sineMin`
  132.                 sineMin;
  133.         }
  134.         
  135.         //    max.
  136.         //
  137.         if (`floatSliderGrp -exists sineMax`) {
  138.             floatSliderGrp -edit 
  139.                 -value `optionVar -query sineMax`
  140.                 sineMax;
  141.         }
  142.         
  143.         //    amplitude.
  144.         //
  145.         if (`floatSliderGrp -exists sineAmplitude`) {
  146.             floatSliderGrp -edit 
  147.                 -value `optionVar -query sineAmplitude`
  148.                 sineAmplitude;
  149.         }
  150.         
  151.         //    wavelength.
  152.         //
  153.         if (`floatSliderGrp -exists sineWavelength`) {
  154.             floatSliderGrp -edit 
  155.                 -value `optionVar -query sineWavelength`
  156.                 sineWavelength;
  157.         }
  158.         
  159.         //    dropoff.
  160.         //
  161.         if (`floatSliderGrp -exists sineDropoff`) {
  162.             floatSliderGrp -edit 
  163.                 -value `optionVar -query sineDropoff`
  164.                 sineDropoff;
  165.         }
  166.         
  167.         //    offset.
  168.         //
  169.         if (`floatSliderGrp -exists sineOffset`) {
  170.             floatSliderGrp -edit 
  171.                 -value `optionVar -query sineOffset`
  172.                 sineOffset;
  173.         }
  174.     }
  175.  
  176.     if ($tabIndex != 1) {
  177.         // Positioning of the sine deformer in the DG
  178.         //
  179.         string $positioning = `optionVar -query sinePositioning`;
  180.         if (`optionMenuGrp -exists sinePositioningWidget`) {
  181.             if ($positioning == "default") {
  182.                 optionMenuGrp -edit -select 1 sinePositioningWidget;
  183.             }
  184.             else if ($positioning == "before") {
  185.                 optionMenuGrp -edit -select 2 sinePositioningWidget;
  186.             }
  187.             else if ($positioning == "after") {
  188.                 optionMenuGrp -edit -select 3 sinePositioningWidget;
  189.             }
  190.             else if ($positioning == "split") {
  191.                 optionMenuGrp -edit -select 4 sinePositioningWidget;
  192.             }
  193.             else if ($positioning == "parallel") {
  194.                 optionMenuGrp -edit -select 5 sinePositioningWidget;
  195.             }
  196.             else {
  197.                 optionMenuGrp -edit -select 1 sinePositioningWidget;
  198.             }
  199.         }
  200.         
  201.         int $exc=`optionVar -query sineExclusive`;
  202.         if (`checkBoxGrp -exists exclWidget`) {
  203.             checkBoxGrp -e -v1 $exc exclWidget;
  204.         }
  205.         string $exn=`optionVar -query sineExclName`;
  206.         if (`textFieldGrp -exists partitionNameWidget`) {
  207.             textFieldGrp -e -tx $exn -enable $exc partitionNameWidget;
  208.         }
  209.         if (`optionMenuGrp -exists partitionListWidget`) {
  210.             optionMenuGrp -e  -enable $exc partitionListWidget;
  211.         }
  212.     }
  213. }
  214.     
  215. //
  216. //  Procedure Name:
  217. //      sineCallback
  218. //
  219. //  Description:
  220. //        Update the option values with the current state of the option box UI.
  221. //
  222. //  Input Arguments:
  223. //      parent - Top level parent layout of the option box UI.  Required so
  224. //               that UI object names can be successfully resolved.
  225. //
  226. //        doIt   - Whether the command should execute.
  227. //
  228. //  Return Value:
  229. //      None.
  230. //
  231. global proc sineCallback(string $parent, int $doIt)
  232. {
  233.     //    Set the optionVar's from the control values, and then
  234.     //    perform the command.
  235.  
  236.     //    Min.
  237.     //
  238.     if (`floatSliderGrp -exists sineMin`) {
  239.         optionVar -floatValue sineMin        
  240.             `floatSliderGrp -query -value sineMin`;
  241.     }
  242.  
  243.     //    Max.
  244.     //
  245.     if (`floatSliderGrp -exists sineMax`) {
  246.         optionVar -floatValue sineMax        
  247.             `floatSliderGrp -query -value sineMax`;
  248.     }
  249.  
  250.     //    amplitude.
  251.     //
  252.     if (`floatSliderGrp -exists sineAmplitude`) {
  253.         optionVar -floatValue sineAmplitude        
  254.             `floatSliderGrp -query -value sineAmplitude`;
  255.     }
  256.  
  257.     //    wavelength.
  258.     //
  259.     if (`floatSliderGrp -exists sineWavelength`) {
  260.         optionVar -floatValue sineWavelength        
  261.             `floatSliderGrp -query -value sineWavelength`;
  262.     }
  263.  
  264.     //    dropoff.
  265.     //
  266.     if (`floatSliderGrp -exists sineDropoff`) {
  267.         optionVar -floatValue sineDropoff        
  268.             `floatSliderGrp -query -value sineDropoff`;
  269.     }
  270.  
  271.     //    offset.
  272.     //
  273.     if (`floatSliderGrp -exists sineOffset`) {
  274.         optionVar -floatValue sineOffset        
  275.             `floatSliderGrp -query -value sineOffset`;
  276.     }
  277.  
  278.     // Positioning of the sine deformer in the DG
  279.     //
  280.     string $positioning = "default";
  281.     if (`optionMenuGrp -exists sinePositioningWidget`) {
  282.         if (`optionMenuGrp -query -select sinePositioningWidget` == 1) {
  283.             $positioning = "default";
  284.         }
  285.         else if (`optionMenuGrp -query -select sinePositioningWidget` == 2){
  286.             $positioning = "before";
  287.         }
  288.         else if (`optionMenuGrp -query -select sinePositioningWidget` == 3){
  289.             $positioning = "after";
  290.         }
  291.         else if (`optionMenuGrp -query -select sinePositioningWidget` == 4){
  292.             $positioning = "split";
  293.         }
  294.         else if (`optionMenuGrp -query -select sinePositioningWidget` == 5){
  295.             $positioning = "parallel";
  296.         }
  297.     }
  298.     optionVar -stringValue sinePositioning $positioning;
  299.  
  300.     if (`checkBoxGrp -exists exclWidget`) {
  301.         optionVar -intValue sineExclusive `checkBoxGrp -q -v1 exclWidget`;
  302.     }
  303.     if (`optionMenuGrp -exists partitionListWidget`) {
  304.         string $partitionNameVal = `optionMenuGrp -q -v partitionListWidget`;
  305.         if ($partitionNameVal == "Create New Partition") {
  306.             if (`textFieldGrp -exists partitionNameWidget`) {
  307.                 $partitionNameVal = `textFieldGrp -q -tx partitionNameWidget`;
  308.             }
  309.         } else {
  310.             // a value of 2 indicates that we use an existing partition
  311.             //
  312.             optionVar -intValue sineExclusive 2;
  313.         }
  314.         
  315.         optionVar -stringValue sineExclName $partitionNameVal;
  316.     }
  317.     
  318.     if ($doIt) {
  319.         performSine 0; 
  320.         addToRecentCommandQueue "performSine 0" "Non-Linear";
  321.     }
  322. }
  323.  
  324.  
  325. //
  326. //  Procedure Name:
  327. //      createSineTabUI
  328. //
  329. //  Description:
  330. //        Create the tab UI.  The contents of each tab are created only 
  331. //        when it is required, ie. if the tab is initially visible or 
  332. //        if the tab is selected by the user.
  333. //
  334. //  Input Arguments:
  335. //      The name of the tab layout.
  336. //
  337. //  Return Value:
  338. //      None.
  339. //
  340. global proc createSineTabUI(string $tabLayout)
  341. {
  342.     string $tab[] = `tabLayout -query -childArray $tabLayout`;
  343.     int $currentTabIndex = `tabLayout -query -selectTabIndex $tabLayout`;
  344.  
  345.     //    Determine if the UI for this tab has been created yet.
  346.     //    This is accomplished by querying the number of children
  347.     //    in the current tab.  If the tab has no children then the UI
  348.     //    must be created.
  349.     //
  350.     if (0 == `columnLayout -query -numberOfChildren $tab[$currentTabIndex-1]`) {
  351.  
  352.         setParent $tab[$currentTabIndex-1];
  353.  
  354.         string $label;
  355.         int $index;
  356.  
  357.         //    Activate the default UI template so that the layout of this 
  358.         //    option box is consistent with the layout of the rest of the 
  359.         //    application.
  360.         //
  361.         setUITemplate -pushTemplate DefaultTemplate;
  362.  
  363.         //    Turn on the wait cursor.
  364.         //
  365.         waitCursor -state 1;
  366.  
  367.         //    The current tab has no children.  Determine which tab is
  368.         //    active and create its UI.
  369.         //
  370.         //    RECOMMENDATION:  Use the 'Grp' commands where possible because
  371.         //    they obey the formatting specified in the default template.
  372.         //    This will result in a more consistent look throughout the
  373.         //    application.
  374.         //    
  375.         if (1 == $currentTabIndex) {
  376.  
  377.             //    Create UI for the first tab.
  378.             //
  379.             floatSliderGrp -label "Low Bound" -fieldMinValue -10000.0 
  380.               -minValue -10.0 -maxValue 0.0 sineMin;
  381.  
  382.             floatSliderGrp -label "High Bound" -minValue 0.0 
  383.               -maxValue 10.0 -fieldMaxValue 10000.0 sineMax;
  384.  
  385.             floatSliderGrp -label "Amplitude" -minValue -5.0 -maxValue 5.0
  386.                 -fieldMinValue -10000.0 -fieldMaxValue 10000.0
  387.                 sineAmplitude;
  388.  
  389.             floatSliderGrp -label "Wavelength" -minValue -0.1 -maxValue 10.0
  390.                 -fieldMinValue -10000.0 -fieldMaxValue 10000.0
  391.                 sineWavelength;
  392.  
  393.             floatSliderGrp -label "Dropoff" -minValue -1.0 -maxValue 1.0 -step .1
  394.                 sineDropoff;
  395.  
  396.             floatSliderGrp -label "Offset" -minValue -10.0 -maxValue 10.0 
  397.                 -fieldMinValue -10000.0 -fieldMaxValue 10000.0
  398.                 sineOffset;
  399.  
  400.             setParent ..;
  401.         }
  402.         else if (2 == $currentTabIndex) {
  403.             
  404.             //    Create UI for the second tab.
  405.             //
  406.             columnLayout -adjustableColumn true;
  407.  
  408.             // Positioning of the sine deformer in the DG
  409.             optionMenuGrp -label "Deformation Order" sinePositioningWidget;
  410.             menuItem -label "Default"       sinePosItem1;
  411.             menuItem -label "Before"        sinePosItem2;
  412.             menuItem -label "After"         sinePosItem3;
  413.             menuItem -label "Split"         sinePosItem4;
  414.             menuItem -label "Parallel"      sinePosItem5;
  415.  
  416.             separator;
  417.             checkBoxGrp    
  418.                 -numberOfCheckBoxes 1
  419.                 -label ""
  420.                 -label1 "Exclusive"
  421.                 -v1 0 
  422.                 -on1 "optionMenuGrp -e -enable 1 partitionListWidget; updatePartitionNameWidget;"
  423.                 -offCommand "optionMenuGrp -e -enable 0 partitionListWidget; updatePartitionNameWidget;"
  424.                 exclWidget;
  425.  
  426.             // Create an option menu listing the partitions
  427.             //
  428.             optionMenuGrp -l "Partition to Use" -enable `checkBoxGrp -q -v1 exclWidget`
  429.                 -cc "updatePartitionNameWidget" partitionListWidget;
  430.  
  431.             string $currentNameOption = "";
  432.             if (`optionVar -exists sineExclName`) {
  433.                 $currentNameOption = `optionVar -q sineExclName`;
  434.             }
  435.             
  436.             // add all the partitions to the menu
  437.             //
  438.             int $pp;
  439.             string $partitionArray[];
  440.             $partitionArray = `ls -type partition`;
  441.             int $partitionCount = size($partitionArray);
  442.             menuItem -l "Create New Partition";
  443.             for ($pp = 0; $pp < $partitionCount; $pp++)
  444.             {
  445.                 // Do not list the render partition as adding items to
  446.                 // it is only going to cause confusion.
  447.                 //
  448.                 if ($partitionArray[$pp] != "renderPartition" && 
  449.                     $partitionArray[$pp] != "characterPartition") {
  450.                     menuItem -l $partitionArray[$pp];
  451.                 }
  452.                 if ($currentNameOption == $partitionArray[$pp]) {
  453.                     optionVar -stringValue sineExclName "deformPartition";
  454.                 }
  455.             }
  456.  
  457.             textFieldGrp -l "New Partition Name" -enable `checkBoxGrp -q -v1 exclWidget` 
  458.                 -tx "deformPartition"
  459.                 partitionNameWidget;
  460.         
  461.             updatePartitionNameWidget;
  462.         }
  463.  
  464.         //    Update the control values to match the options.
  465.         //
  466.         eval (("sineSetup " + $tabLayout + " "+0+" "+$currentTabIndex));
  467.     
  468.         //    Turn off the wait cursor.
  469.         //
  470.         waitCursor -state 0;
  471.         
  472.         //    Deactivate the default UI template.
  473.         //
  474.         setUITemplate -popTemplate;
  475.     }
  476. }
  477.  
  478. //
  479. //  Procedure Name:
  480. //      sineOptions
  481. //
  482. //  Description:
  483. //        Construct the option box UI.  Involves accessing the standard option
  484. //        box and customizing the UI accordingly.
  485. //
  486. //  Input Arguments:
  487. //      None.
  488. //
  489. //  Return Value:
  490. //      None.
  491. //
  492. // ********* Change 'sine' in this proc to be the name of your command
  493. proc sineOptions()
  494. {
  495.     //    Name of the command for this option box.
  496.     //
  497.     string $commandName = "nonLinear";
  498.  
  499.     //    Build the option box actions.
  500.     //
  501.     string $callback = ("sineCallback");
  502.     string $setup = ("sineSetup");
  503.  
  504.     //    STEP 1:  Get the option box.
  505.     //    ============================
  506.     //
  507.     //  The value returned is the name of the layout to be used as
  508.     //    the parent for the option box UI.
  509.     //
  510.     string $layout = getOptionBox();
  511.     setParent $layout;
  512.     
  513.     //    STEP 2:  Pass the command name to the option box.
  514.     //    =================================================
  515.     //
  516.     //    Any default option box behaviour based on the command name is set 
  517.     //    up with this call.  For example, updating the 'Help' menu item with
  518.     //    the name of the command.
  519.     //
  520.     setOptionBoxCommandName($commandName);
  521.  
  522.     //    STEP 3:  Activate the default UI template.
  523.     //    ==========================================
  524.     //
  525.     //    Activate the default UI template so that the layout of this 
  526.     //    option box is consistent with the layout of the rest of the 
  527.     //    application.
  528.     //
  529.     //    Note: this option box example delays the creation of the UI
  530.     //    until it's required.  Therefore this step is moved to the
  531.     //    procedure where the UI is actually created. 
  532.     //
  533.     //setUITemplate -pushTemplate DefaultTemplate;
  534.  
  535.     //    STEP 4: Create option box contents.
  536.     //    ===================================
  537.     //    
  538.     //    This, of course, will vary from option box to option box.    
  539.     
  540.     //    Demonstrate the delaying of UI creation via tab layouts.
  541.     //    Instead of creating all of the option box UI initially, only
  542.     //    create that which is initially visible.  Wait, until the 
  543.     //    other tabs are selected to create the remaining UI.
  544.     //
  545.     string $tabLayout = `tabLayout -scrollable 1`;
  546.  
  547.     //    Attach an action that will be invoked before a tab is selected.
  548.     //    
  549.     tabLayout -edit 
  550.         -preSelectCommand ("createSineTabUI " + $tabLayout)
  551.         $tabLayout;
  552.  
  553.     //    Create just the immediate children of the tab layout so that
  554.     //    the tabs appear.
  555.     //
  556.     columnLayout;
  557.         setParent ..;
  558.     columnLayout;
  559.         setParent ..;
  560.     
  561.     //    Set the tab labels.
  562.     //
  563.     tabLayout -edit
  564.         -tabLabelIndex 1 "Basic"
  565.         -tabLabelIndex 2 "Advanced"
  566.         $tabLayout;
  567.  
  568.     //    Create the UI for the tab that is initially visible.
  569.     //
  570.     createSineTabUI($tabLayout);
  571.  
  572.     //    Step 5: Deactivate the default UI template.
  573.     //  ===========================================
  574.     //
  575.     //    Note: this option box example delays the creation of the UI
  576.     //    until it's required.  Therefore this step is moved to the
  577.     //    procedure where the UI is actually created.
  578.     //
  579.     //    See also Step 2. 
  580.     //
  581.     //setUITemplate -popTemplate;
  582.  
  583.     //    Step 6: Customize the buttons.  
  584.     //    ==============================
  585.     //
  586.     //    Provide more descriptive labels for the buttons.  This is not 
  587.     //    necessary, but in some cases, for example, a button labelled 
  588.     //    'Create' may be more meaningful to the user than one labelled
  589.     //    'Apply'.
  590.     //
  591.     //  Disable those buttons that are not applicable to the option box.
  592.     //
  593.     //    Attach actions to those buttons that are applicable to the option
  594.     //    box.  Note that the 'Close' button has a default action attached 
  595.     //    to it that will hide the window.  If a a custom action is
  596.     //    attached to the 'Close' button then be sure to call the 'hide the
  597.     //    option box' procedure within the custom action so that the option
  598.     //    box is hidden properly.
  599.  
  600.     //    'Apply' button.
  601.     //
  602.     string $applyBtn = getOptionBoxApplyBtn();
  603.     button -edit
  604.         -label "Create"
  605.         -command ($callback + " " + $tabLayout + " " + 1)
  606.         $applyBtn;
  607.  
  608.     //    'Save' button.
  609.     //
  610.     string $saveBtn = getOptionBoxSaveBtn();
  611.     button -edit 
  612.         -command ($callback + " " + $tabLayout + " " + 0 + "; hideOptionBox")
  613.         $saveBtn;
  614.  
  615.     //    'Reset' button.
  616.     //
  617.     string $resetBtn = getOptionBoxResetBtn();
  618.     button -edit 
  619.         -command ($setup + " " + $tabLayout + " " + 1 + " " + 0)
  620.         $resetBtn;
  621.  
  622.     //    Step 7: Set the option box title.
  623.     //    =================================
  624.     //
  625.     setOptionBoxTitle("Create Sine Deformer Options");
  626.  
  627.     //    Step 8: Customize the 'Help' menu item text.
  628.     //    ============================================
  629.     //
  630.     setOptionBoxHelpTag( "Sine" );
  631.  
  632.     //    Step 9: Set the current values of the option box.
  633.     //    =================================================
  634.     //
  635.     //    NOTE:  Can not do this here since we do not know what UI is
  636.     //    currently visible.  This is moved to where the UI is created.
  637.     //
  638.     //eval (($setup + " " + $tabLayout + " " + 0));    
  639.     
  640.     //    Step 10: Show the option box.
  641.     //    =============================
  642.     //
  643.     showOptionBox();
  644. }
  645.  
  646. //
  647. //  Procedure Name:
  648. //      optionBoxExample1Help
  649. //
  650. //  Description:
  651. //        Return a short description about this command.
  652. //
  653. //  Input Arguments:
  654. //      None.
  655. //
  656. //  Return Value:
  657. //      string.
  658. //
  659. proc string sineHelp()
  660. {
  661.     return 
  662.     "  Command: sine - creates a sine\n" +
  663.     "Selection: Deformable geometry.";    
  664. }
  665.  
  666. proc string getCmd()
  667. {
  668.     string $cmd = "nonLinear -type sine";
  669.  
  670.     $cmd += " -lowBound " + `optionVar -query sineMin`;
  671.     $cmd += " -highBound " + `optionVar -query sineMax`;
  672.     $cmd += " -amplitude " + `optionVar -query sineAmplitude`;
  673.     $cmd += " -wavelength " + `optionVar -query sineWavelength`;
  674.     $cmd += " -dropoff " + `optionVar -query sineDropoff`;
  675.     $cmd += " -offset " + `optionVar -query sineOffset`;
  676.  
  677.      // Build a positioning flag if needed
  678.     //
  679.     string $positioning = `optionVar -query sinePositioning`;
  680.     if ($positioning != "default") {
  681.         $cmd += (" -" + $positioning);
  682.     }
  683.     
  684.     int $exc=`optionVar -query sineExclusive`;
  685.     if ($exc) {
  686.         string $exn=`optionVar -query sineExclName`;
  687.         if ($exn!="") {
  688.             // make sure that we do not clash names with an existing
  689.             // partition when the user requested a new partition, even
  690.             // if the user may have entered a non-unique name
  691.             //
  692.             if ($exc == 1)     $exn += "#";
  693.             $cmd += (" -exclusive \"" + $exn+"\"");
  694.         }
  695.     }
  696.     
  697.     return $cmd;
  698. }
  699.  
  700.  
  701. //
  702. //  Procedure Name:
  703. //      performSine
  704. //
  705. //  Description:
  706. //        Perform the sine command using the corresponding 
  707. //        option values.  This procedure will also show the option box
  708. //        window if necessary as well as construct the command string
  709. //        that will invoke the sine command with the current
  710. //        option box values.
  711. //
  712. //  Input Arguments:
  713. //      0 - Execute the command.
  714. //      1 - Show the option box dialog.
  715. //      2 - Return the command.
  716. //
  717. //  Return Value:
  718. //      None.
  719. //
  720. global proc string performSine(int $action)
  721. {
  722.     string $cmd = "";
  723.  
  724.     switch ($action) {
  725.  
  726.         //    Execute the command.
  727.         //
  728.         case 0:
  729.             //    Retrieve the option settings
  730.             //
  731.             setOptionVars(false);
  732.  
  733.             //    Get the command.
  734.             //
  735.             $cmd = getCmd();
  736.  
  737.             //    Execute the command with the option settings.
  738.             //
  739.             evalEcho($cmd);
  740.  
  741.             break;
  742.  
  743.         //    Show the option box.
  744.         //
  745.         case 1:
  746.             sineOptions;
  747.             break;
  748.  
  749.         //    Return the command string.
  750.         //
  751.         case 2:
  752.             //    Retrieve the option settings.
  753.             //
  754.             setOptionVars (false);
  755.  
  756.             //    Get the command.
  757.             //
  758.             $cmd = getCmd();
  759.             break;
  760.     }
  761.     return $cmd;
  762. }
  763.  
  764.